<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#cotainer
			{
				height: 800px;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
			}
			#imghidden
			{
				width: 600px;
				height: 500px;
				overflow: hidden;
			}
			#imgList
			{
				height: 100px;
				width: 1000px;
				display: flex;
			}
			#imgList img
			{
				height: 100px;
				width: 100px;
			}
		</style>
	</head>
		<div id="cotainer">
			<div id="imghidden">
				<div id="imgList" onmouseenter="imgStop()" onmouseleave="imgRun()">
					<img src="img/lunbo/1.jpeg" >
					<img src="img/lunbo/2.jpeg" >
					<img src="img/lunbo/3.jpeg" >
					<img src="img/lunbo/4.jpeg" >
					<img src="img/lunbo/5.jpeg" >
					<img src="img/lunbo/6.jpeg" >
					<img src="img/lunbo/7.jpeg" >
					<img src="img/lunbo/8.jpeg" >
					<img src="img/lunbo/9.jpeg" >
					<img src="img/lunbo/10.jpeg" >
					<img src="img/lunbo/1.jpeg" >
					<img src="img/lunbo/2.jpeg" >
					<img src="img/lunbo/3.jpeg" >
					<img src="img/lunbo/4.jpeg" >
					<img src="img/lunbo/5.jpeg" >
					<img src="img/lunbo/6.jpeg" >
				</div>
			</div>	
		</div>
	</body>
	<script type="text/javascript">
		var imgListObj = document.getElementById('imgList');
		var marginLeft = 0;
		var myTimer = null;
		var flag = true;
		
		function doRollTimer()
		{
			if (flag) {
				if (marginLeft == -1000) {
					marginLeft = 0;
				}
				marginLeft--;
				imgListObj.style.marginLeft = marginLeft+'px';
				
				if (marginLeft%100 == 0) {
					clearInterval(myTimer);
					setTimeout(function()
					{
						// clearInterval(myTimer);
						myTimer = setInterval(doRollTimer,20);
					},1000);
				} 
			} 
		}
		
		function imgStop()
		{
			flag = false;
			// clearInterval(myTimer);
		}
		function imgRun()
		{
			flag = true;
			// clearInterval(myTimer);
			// myTimer = setInterval(doRollTimer,20);
			// console.log(myTimer);
		}
		
		onload = function()
		{
			myTimer = setInterval(doRollTimer,20);
		}
	</script>
</html>
